//package com.lvhx.springboot.controller;
//
//import com.alibaba.excel.EasyExcel;
//import com.lvhx.springboot.entity.EasyExcelBean;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.math.BigDecimal;
//import java.net.URLEncoder;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//
//@RestController
//@RequestMapping("/easyexcel")
//public class EasyExcelController {
//
//    @PostMapping("/downLoad")
//    public String downloadExcel(HttpServletResponse response) throws IOException {
//
//        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
//        response.setCharacterEncoding("utf-8");
//        // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
//        String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20");
//        response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
//        // 如果指定了ExcelProperty,那么可以不用不用指定head,到处的excel仍然含有标题，如果想要多标题，那么就需要指定
//        EasyExcel.write(response.getOutputStream(), EasyExcelBean.class).sheet("用户表").doWrite(data());
//        return "success";
//    }
//
//
//    private List<EasyExcelBean> data() {
//        List<EasyExcelBean> list = new ArrayList<>();
//        EasyExcelBean easyExcelBean = new EasyExcelBean("123456", new Date(), new BigDecimal("10"));
//        list.add(easyExcelBean);
//        return list;
//    }
//
//
//}
